package com.nbicc.service.impl;

import com.github.pagehelper.PageInfo;
import com.nbicc.mapper.FinanMapper;
import com.nbicc.pojo.Finan;
import com.nbicc.service.FinanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/5/10 20:34
 * @Version 1.0 (版本)
 */
@Service
public class FinanServiceImpl implements FinanService {
    @Autowired
    private FinanMapper finanMapper;
    @Override

    @Transactional
    public PageInfo<Finan> selectAll() {
        List<Finan> finans = finanMapper.selectList(null);
        PageInfo<Finan> pageInfo = new PageInfo<>(finans);
        return pageInfo;
    }

    @Override
    @Transactional
    public int deletById(Integer id) {
        return finanMapper.deleteById(id);
    }

    @Override
    @Transactional
    public int updateById(Finan finan) {
        return finanMapper.updateById(finan);
    }

    @Override
    @Transactional
    public int addFinan(Finan finan) {
        return finanMapper.insert(finan);
    }

    @Override
    @Transactional
    public PageInfo<Finan> selectAllSB(String comm) {
        List<Finan> finans = finanMapper.selectAllSB(comm);
        PageInfo<Finan> pageInfo = new PageInfo<>(finans);
        return pageInfo;
    }

    @Override
    @Transactional
    public Finan selectById(Integer id) {
        return finanMapper.selectById(id);
    }

    @Override
    @Transactional
    public Double totalRow() {
        return finanMapper.totalRow();
    }

    @Override
    @Transactional
    public int insertFinan(Finan finan) {
        return finanMapper.insertFinan(finan);
    }

    @Override
    @Transactional
    public List<Finan> selectAllExcel() {
        return finanMapper.selectList(null);
    }
}
